package com.wuyan.locationdog.util.maputil;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.amap.api.maps.AMap;
import com.amap.api.maps.model.Marker;
import com.wuyan.locationdog.R;

public class CustomInfoWindowAdapter implements AMap.InfoWindowAdapter {

    private View mInfoWindow;

    public CustomInfoWindowAdapter(Context context) {
        mInfoWindow = LayoutInflater.from(context).inflate(R.layout.custom_info_window3, null);
    }

    @Override
    public View getInfoWindow(Marker marker) {
        // 更新InfoWindow内容
        TextView tvTitle = mInfoWindow.findViewById(R.id.tvTitle);
        tvTitle.setText(marker.getTitle());
        return mInfoWindow;
    }

    @Override
    public View getInfoContents(Marker marker) {
        // 这里可以自定义InfoWindow的内容，但如果不想自定义，可以返回null
        return null;
    }
}
